/* eslint valid-jsdoc: "off" */

'use strict';

const path = require('path')
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1697361418050_583';

  // add your middleware config here
  config.middleware = [];
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    security: {
      csrf: {
        enable: false,
        ignoreJSON: true
      },
    },
    cors: {
      origin: '*',
      credentials: true,
      allowMethods: 'POST,GET,OPTIONS'
    },
    photo: {
      path: '/images',
      urlSuffix: 'http://121.40.59.97/images/'
    },
    deploy: {
      cacheRoute:path.resolve('./','cache'),
      ownerRepoMap: {
        'sheeyeh': [
          {
            repoName: '垃圾管理系统django后台',
            repo: 'rubbish_bin',
            allowUse: true,
            port:3001,
          }
        ]
      },
      repoRouteMap: {
        'rubbish_bin': {
          localRepoRoot: '/rubbish_bin',
          script: path.resolve('./app','script','rubbish_bin_deploy.sh'),
          port:3001,
          remoteUrl:'git@gitee.com:sheeyeh/rubbish_bin.git'
        }
      },
      portInUse:[]
    },
    multipart: {
      mode: 'file',
      allowArrayField: true
    },
    cluster: {
      listen: {
        port: 7001,
        hostname: '0.0.0.0'
      }
    },
    // mysql: {
    //   client: {
    //     host: 'localhost',
    //     port: '3306',
    //     user: 'root',
    //     password: '2323232Asd',
    //     database: 'education',
    //   }
    // },
  };

  return {
    ...config,
    ...userConfig,
  };
};